package lab02.test11;

public class Rectangle implements Printx {
    double width;
    double height;
    double area;
    double perimeter;

    public double getArea() {
        return area = width * height;
    }

    public void setArea(double area) {
        this.area = area;
    }

    public double getPerimeter() {
        return perimeter = 2 * width + 2 * height;
    }

    public void setPerimeter(double perimeter) {
        this.perimeter = perimeter;
    }

    public Rectangle() {}

    @Override
    public void printMyWay() {
        System.out.println("矩形长为：" + width + "\n" + "矩形宽为：" + height + "\n"
                + "面积：" + getArea() + "\n" + "周长：" + getPerimeter());
    }

}
